<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>增加赛事</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/Swiper/3.4.2/css/swiper.min.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/Swiper/3.4.2/js/swiper.jquery.min.js"></script>
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>

    <script language="JavaScript" type="text/javascript">
        //判断规则（正则表达式）
        function goto() {
            var cpname = document.getElementById("cpname");
            var cpintro = document.getElementById("cpintro");

            if (cpname.value.trim().length < 4) {
                alert("赛事名不少于四个字");
                cpname.focus()
                cpname.value = "";
                return;
            }

            if (cpintro.value.trim().length < 15) {
                alert("赛事简介不少于十五个字");
                cpintro.focus()
                cpintro.value = "";
                return;
            }


        }
    </script>

</head>
<body>
<!-- 顶部开始 -->
<div th:replace="common::#topbar"></div>
<!-- 顶部结束 -->
<!-- 中部开始 -->
<div class="wrapper">
    <!-- 左侧菜单开始 -->
    <div th:replace="common::#leftbar"></div>
    <!-- 左侧菜单结束 -->
    <!-- 右侧主体开始 -->
    <div class="page-content">
        <div class="content">
            <!-- 右侧内容框架，更改从这里开始 -->

            <fieldset class="layui-elem-field layui-field-title site-title">
                <legend><a name="default">添加赛事信息</a></legend>
            </fieldset>
            <form class="layui-form" th:action="@{/doadd-event}" method="post">
                <div class="layui-form-item">
                    <label for="cpname" class="layui-form-label">
                        <span class="x-red"></span>赛事名称
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="cpname" name="cpname" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" placeholder="赛事名称不少于四个字">
                    </div>


                </div>

                <div class="layui-form-item">
                    <label for="cptype" class="layui-form-label">
                        <span class="x-red"></span>赛事类别
                    </label>
                    <div class="layui-input-inline">
                        <select id="cptype" name="cptype" class="form-control">
                            <option value="超级">超级</option>
                            <option value="一级">一级</option>
                            <option value="二级">二级</option>
                            <option value="三级">三级</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label for="cpintro" class="layui-form-label">
                        <span class="x-red"></span>赛事简介
                    </label>
                    <div class="layui-input-inline" style="width: 41%">
                        <input type="text" id="cpintro" name="cpintro" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" placeholder="赛事简介不少于十五个字">
                    </div>

                </div>

                <div class="layui-form-item">
                    <label for="cpstime" class="layui-form-label">
                        <span class="x-red"></span>开始时间
                    </label>
                    <div class="layui-input-inline">
                        <input type="datetime-local" id="cpstime" name="cpstime" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" placeholder="yyyy-MM-dd">
                    </div>

                </div>

                <div class="layui-form-item">
                    <label for="cpetime" class="layui-form-label">
                        <span class="x-red"></span>结束时间
                    </label>
                    <div class="layui-input-inline">
                        <input type="datetime-local" id="cpetime" name="cpetime" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" placeholder="yyyy-MM-dd">
                    </div>

                </div>

                <div class="layui-form-item">
                    <label for="place" class="layui-form-label">
                        <span class="x-red"></span>赛事场地
                    </label>
                    <div class="layui-input-inline">
                        <select id="place" name="plid" class="form-control">
                            <option th:each="place:${places}" th:value="${place.id}" th:text="${place.getAddress()}">1
                            </option>
                        </select>
                    </div>

                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">
                    </label>
                    <input type="submit" name="添加" onclick="goto()" class="layui-btn">
                    <!--                      <button type="submit" name="添加"  class="layui-btn"></button>-->
                </div>
            </form>
            <!-- 右侧内容框架，更改从这里结束 -->
        </div>
    </div>
    <!-- 右侧主体结束 -->
</div>
<!-- 中部结束 -->
<!-- 底部开始 -->
<div th:replace="common::#bottombar"></div>
<!-- 底部结束 -->
<!-- 背景切换开始 -->
<div th:replace="common::#backbar"></div>
<!-- 背景切换结束 -->
</body>
</html>